C and C++: a Case for Compatibility

نویسنده

  • Bjarne Stroustrup
چکیده

This article presents a case for significantly increasing the degree of compatibility between C and C++. The ideal proposed is full compatibility. This ideal is not trivially obvious nor technically easy to achieve. Therefore, arguments against full compatibility are presented as well as arguments for. A companion paper [Stroustrup,2002a] provides a ‘‘philosophical’’ view of the C/C++ relationship, and a follow-up article will present some examples of how incompatibilities might be resolved [Stroustrup,2002c]. 1 Languages and Communities Modern C [C89] [C99] and C++ [C++98] are sibling languages [Stroustrup,2002] [Stroustrup,2002a] descended from Classic C [Kernighan,1978]. In many people’s minds they are (wrongly, but understandably) fused into the mythical C/C++ programming language. There is no C/C++ language, but there is a C/C++ community. The primary aim of this article is to examine how the future evolution of C and C++ can best serve that community. My claim is that a significant increase in the degree of C/C++ compatibility best serves the interests of the C/C++ community and that the ideal is full C/C++ compatibility. What is the C/C++ community? Millions of programmers use C and/or C++ so any individual and any organization necessarily has an incomplete picture of the situation and often a biased one. Consider for a moment three groups: [1] programmers who use C only [2] programmers who use C++ only [3] programmers who use both C and C++ Within each group, we can again look at a multitude of classifications. For example, students, teachers, occasional programmers, games programmers, builders of large systems, embedded systems programmers, scientific/numeric programmers, builders of small commercial applications, programmers with a great need for portability, builders of applications embedded in large commercial frameworks, software tool builders, programmers of large infrastructure applications, etc. It is hard to place an individual in a single category. Importantly, many programmers belong to several of these groups and subgroups during a career, even if they are currently comfortable in some single category. Are there people who use C++ and never C? Of course there are many C++ programmers who never compiled a C source file, but how many C++ programs don’t call a C library? If a C library is used directly, the programmer must understand the constructs appearing in its header files. Even if C code is used only indirectly, some aspects of C must often be taken into account, such as C’s use of m a l l o c () rather than n e w , the use of arrays rather than C++ standard library containers, and the absence of exception handling. The use a C in one part of a program often affects other parts of the program, so that a C++ programmer must be aware of C. And of course, the C++ standard library includes the C89 standard library. It is only a slight exaggeration to say that all C++ programmers are C programmers. On the other hand, there are C programmers who never use C++. This is obviously true for programmers who – especially in the embedded systems community – work on a platform for which no C++ compiler exist. There are fewer such platforms than there used to be, though, and not all of those support ISO Part of a three-article series from "The C/C++ Users Journal" July, August, and September 2002

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Blood group incompatibility due to anti C antibody: a case report

Background and Aim: One of the main goals of blood transfusion medicine is to determine the compatibility of the blood products with the patients. Therefore, clinical and laboratory (serologic) evaluations should be done to determine the maximum compatibility (or minimum incompatibility). The most known blood groups is the ABO antigenic system and the most important of them is Rh system. Among ...

متن کامل

Preparation of persisted luminescence pigment and investigation of in glaze compatibility

In this paper, preparation of SrAl2O4:Eu,Dy luminescent pigment has been investigated. Coprecipitation as a low cost and facile method was selected. X-ray diffraction patterns indicated the formation of SrAl2O4:Eu,Dy phase through calcinations process above 800 °C. Moreover, a few amount of silica caused the structural transformation to alumina silicate phase. Transparent glaze which consist of...

متن کامل

C and C++: Case Studies in Compatibility

This article gives examples of how one might go about increasing the degree of compatibility of C and C++. The ideal is full compatibility. Topics covered includes, variadic functions, v o i d *, b o o l , f (v o i d ), c o n s t , i n l i n e , and variable length arrays. These topics allows a demonstration of concerns that must be taken into account when trying to increase C/C++ compatibility...

متن کامل

Hidden Ideologies within Imported Language Teaching Series: This time the case of Four Corners and Impact Values Series

Extracting incompatible values in the best-sellers current in ELT markets is a real concern. In this study, the researchers tried to bring some claims/counterclaims for hidden ideologies regarding two imported English language teaching coursebooks-Four Corners and Impact Values Series, which are commonly taught within Iranian English language institutes. The main intention was that they might t...

متن کامل

نیازهای گرمایی زنبور سیاه مغزخوار پسته (Eurytoma plotnikovi Nikolskaya) پس از زمستان گذرانی

In winter 1997 severely infested pistachio nuts were collected from orchards in Borkhar district of Isfahan to determine minimum threshold temperature and thermal constants. Minimum threshold temperatures were calculated according to rate of development or X-intercept method and the least coefficient of variation method. Thermal constants were calculated for different developmental stages in th...

متن کامل

نیازهای گرمایی زنبور سیاه مغزخوار پسته (Eurytoma plotnikovi Nikolskaya) پس از زمستان گذرانی

In winter 1997 severely infested pistachio nuts were collected from orchards in Borkhar district of Isfahan to determine minimum threshold temperature and thermal constants. Minimum threshold temperatures were calculated according to rate of development or X-intercept method and the least coefficient of variation method. Thermal constants were calculated for different developmental stages in th...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2002